UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pue63ojo3s5Bxo5ZbVBMqjIfFb27UcWRbSKzR/gu+bo=' 
WHERE 
  key_id = 'e8c28da3b4956565116cf72a3a1cc8dc7f3086c43560df61522583f8edacebc3' 
  AND (
    token = 'Pue63ojo3s5Bxo5ZbVBMqjIfFb27UcWRbSKzR/gu+bo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034