UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ekW40cJhjEfN80skyxx8+eNcZDCs0eL/OoclkfnIYq0=' 
WHERE 
  key_id = '6d4cf517afb6187516da746d76724156d2253c349a809555d9ac0d7a98d6c9b1' 
  AND (
    token = 'ekW40cJhjEfN80skyxx8+eNcZDCs0eL/OoclkfnIYq0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028