UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W/iegpwFFojDkcqxqMJklmEMfZRxmDI6ShKiLQI+yoA=' 
WHERE 
  key_id = '6b2ca2e14bad9a40aabd41d470a2aa889ed26df659e37bf74712e61264954439' 
  AND (
    token = 'W/iegpwFFojDkcqxqMJklmEMfZRxmDI6ShKiLQI+yoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030