UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't1+Q8xxps7QBtAe0naCRcefg23I5vtbdx7zzRlLUQso=' 
WHERE 
  key_id = '3214aca608cab143a516af22e14cb0238a98b1a68a850633f1524755eb015ea2' 
  AND (
    token = 't1+Q8xxps7QBtAe0naCRcefg23I5vtbdx7zzRlLUQso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033