UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CPGQPPrQsFNK/pD9Rk769bHiSOc/Z6GfwsSAKxv95Qc=' 
WHERE 
  key_id = '0e922e1634656f278f989500e265ffe3942052677aaa411298c17df13d49dbd4' 
  AND (
    token = 'CPGQPPrQsFNK/pD9Rk769bHiSOc/Z6GfwsSAKxv95Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030