UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YBi2Dk+nP89uIXw/pztBrhfJXmObHH0XzH4l//0Qyp0=' 
WHERE 
  key_id = 'fd7aac0a97d9849c60f8e294f54683c7975e77ff8f6f84c31fa6517e700d56ee' 
  AND (
    token = 'YBi2Dk+nP89uIXw/pztBrhfJXmObHH0XzH4l//0Qyp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051