UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qBHAvNf3A8Vhs7eioddlI9PQ/lFrGN+qOoaBgy9gGUc=' 
WHERE 
  key_id = '5c12e30ee892fd0b138f0762cd438c52f89702e5bd6863b7efa29013d0cc0d7b' 
  AND (
    token = 'qBHAvNf3A8Vhs7eioddlI9PQ/lFrGN+qOoaBgy9gGUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039