UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4U/z8tLPM+pY2IJkP1Pa2ro9WOvjIXeWIpIVNwdOmNY=' 
WHERE 
  key_id = '0adc39f8f8306d890453d05543035aa989e1061e43b45b7139e07659048502ac' 
  AND (
    token = '4U/z8tLPM+pY2IJkP1Pa2ro9WOvjIXeWIpIVNwdOmNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035