UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q5W9DVtgC7QqGyLNqSiiL6YoujQbfM1xT8o1kYrOMqQ=' 
WHERE 
  key_id = '268d318570bbc79e7a84cfa4fe8f474d097335e1d5e53a0fa5424d1e297ab2c3' 
  AND (
    token = 'q5W9DVtgC7QqGyLNqSiiL6YoujQbfM1xT8o1kYrOMqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038