UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Po9ZBPm1cWdwoingk6CbeOuX3GtD/ACzGE6pUPFY1A0=' 
WHERE 
  key_id = '17f5670f8f98432842255153d15bcbddeff3e8089ecb7635e0640a03cb2f1c32' 
  AND (
    token = 'Po9ZBPm1cWdwoingk6CbeOuX3GtD/ACzGE6pUPFY1A0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022