UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DJ88Q2uQRM3ty+YXQ5OpasyJvLeu6ZdeLMGHmkDvO1A=' 
WHERE 
  key_id = '3413ca81d6b6d3477be176b6e2594f03a1770070ccc58ba861937bb4560b8b96' 
  AND (
    token = 'DJ88Q2uQRM3ty+YXQ5OpasyJvLeu6ZdeLMGHmkDvO1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039