UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mb3+lkruhb+667VVAXLOLOHknYZEAcPWRmQhA2PPyg4=' 
WHERE 
  key_id = 'c270ecb93e779000b4a5438142cf1622c3a39dccb16150198fd2c78fd5be9c28' 
  AND (
    token = 'Mb3+lkruhb+667VVAXLOLOHknYZEAcPWRmQhA2PPyg4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034