UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8lX/p+TkLUwBGQen7NWWLxG2dh5/EAngwSzSQrY2daM=' 
WHERE 
  key_id = '4536c09f108fde3c37c8ae78b0677084b9631de1f8b92266b8a737789ed3252a' 
  AND (
    token = '8lX/p+TkLUwBGQen7NWWLxG2dh5/EAngwSzSQrY2daM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025