UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QgVMy7HlcOkwJqDL4YKUq53Pr+J6z+4vjiW/g2ilXVA=' 
WHERE 
  key_id = '5f8a87614bf6a2f157150c89183d8f39c719c67aeb268221415c4e686d7f5d58' 
  AND (
    token = 'QgVMy7HlcOkwJqDL4YKUq53Pr+J6z+4vjiW/g2ilXVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028