UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N9bmnvoZiZZhkGNUVohWMlrm7YI1/4HXO1ZeV+8heuM=' 
WHERE 
  key_id = '1bcf4d3c0f7d1ce857fbc626ba788245c610fed778b1fe9e73a78dd573bdf4fd' 
  AND (
    token = 'N9bmnvoZiZZhkGNUVohWMlrm7YI1/4HXO1ZeV+8heuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030