UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MKGqPu+6f7/J+b3Z4MpoHPs2fQCFJinhbfX04guNBAM=' 
WHERE 
  key_id = '204f7c8ca6f1b3d02de3f5aa38298e5482e7d1cdbaea7199744f3112c2527458' 
  AND (
    token = 'MKGqPu+6f7/J+b3Z4MpoHPs2fQCFJinhbfX04guNBAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021