UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gorRKGfPILFayaIVJyprl5JjGI4J7iJsEz+Q4Hruqko=' 
WHERE 
  key_id = '9e57d2d0aa3368840ebb2f2a7fc5cf990f0242052250db61881edb46b106e32a' 
  AND (
    token = 'gorRKGfPILFayaIVJyprl5JjGI4J7iJsEz+Q4Hruqko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037