UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K/MoNm47gBCw6b8rpxz52Wkic3cKsIqqM3lDF495Y68=' 
WHERE 
  key_id = 'cfe473a3aac96088ccebb4506db55243e62d18f579230ccf361d4689bacc9842' 
  AND (
    token = 'K/MoNm47gBCw6b8rpxz52Wkic3cKsIqqM3lDF495Y68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030