UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9GeMNOnfYlm0YGZCV8le+wmG4SJsjPgg1pRemv5qyOM=' 
WHERE 
  key_id = '93b3a7722c6d022617e79c151195e164186dcb92a356226ae83dceb07b1ce28b' 
  AND (
    token = '9GeMNOnfYlm0YGZCV8le+wmG4SJsjPgg1pRemv5qyOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035