UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wB2APX4Pjfa670PW/271xpX/Q5zQPtWVlDLzGaGFbxE=' 
WHERE 
  key_id = 'd5180d3e5207c0814b55227950fbb0bc7d122384d673505c4fcb2c6410c5b7a2' 
  AND (
    token = 'wB2APX4Pjfa670PW/271xpX/Q5zQPtWVlDLzGaGFbxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026