UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nANg8KSTfP/IQzz/euYGBPLOdt+AJ+uNMfjghUhE/6o=' 
WHERE 
  key_id = 'c180e9b7e1201b732ea9edb5217e4bf07cce58af8a30161bd07ddffbba02c98f' 
  AND (
    token = 'nANg8KSTfP/IQzz/euYGBPLOdt+AJ+uNMfjghUhE/6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040