UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Ihmw0P5AgiveQOy+eCouPRXtjVQWvs+8F+6qdWFe4E=' 
WHERE 
  key_id = '38f20d4a7a4276504b2425237b00c797a637b6b2e8c917caf0e63d8b37bdba96' 
  AND (
    token = '7Ihmw0P5AgiveQOy+eCouPRXtjVQWvs+8F+6qdWFe4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033