UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sL+sivpZ7dxBcJEYE8j0ohHhbI173CketDFLOjEAB0w=' 
WHERE 
  key_id = '271278b45094e5a1382ded13c0f5fbb83a470fc20de2152ad2e7b9098136607e' 
  AND (
    token = 'sL+sivpZ7dxBcJEYE8j0ohHhbI173CketDFLOjEAB0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023