UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KDAP7Chf71udjOOHc8kp2R38tFdl27fA1U/urdmTzro=' 
WHERE 
  key_id = 'f31c0115bebb5078bd158cea287da0cffc0188cda1cbbc58a88b259527fa5ed5' 
  AND (
    token = 'KDAP7Chf71udjOOHc8kp2R38tFdl27fA1U/urdmTzro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039