UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EWGW07lCJIFuhZyavOtS4Ok2iDSNuvIwHzY+wHv5f/E=' 
WHERE 
  key_id = '627e70a3ae7505720dae4c5d5fec8eadc8d1f217d5ebd5b4ebd53c3240d1f47f' 
  AND (
    token = 'EWGW07lCJIFuhZyavOtS4Ok2iDSNuvIwHzY+wHv5f/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016