UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ep1iVrjA54C8TC+ac1iBgWKzY4uQb61shdVFXpuv9Q=' 
WHERE 
  key_id = 'd5649c42bfa4172bfc0edb51e8ae7c045274cf2b68dabdb48897ac7d26d5ebbb' 
  AND (
    token = '7ep1iVrjA54C8TC+ac1iBgWKzY4uQb61shdVFXpuv9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033