UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tvMpcx7V+xsKPFAhu8hGkcH90rYsNSY2DgE/lljaNFk=' 
WHERE 
  key_id = 'b2b46601ca64bb851386e7387127afdd5d2e3ee6e73c9c1f6d3f2adedf3b46ee' 
  AND (
    token = 'tvMpcx7V+xsKPFAhu8hGkcH90rYsNSY2DgE/lljaNFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026