UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T+7lIeyBURDH2w7wSYBmUzaXxNJ5B8T7MFvGXJyGpEk=' 
WHERE 
  key_id = '133d823e529bd6593156adce34e4231706c6803f53fd61ee99f853d44fcc59b4' 
  AND (
    token = 'T+7lIeyBURDH2w7wSYBmUzaXxNJ5B8T7MFvGXJyGpEk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044