UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TUPNAGro+T13huJEV5rMGkSpUarubI79v5PCH9Is+QA=' 
WHERE 
  key_id = 'c4f19489060118f744e9047a2060f84c667097fa12a77c1231a7057201239416' 
  AND (
    token = 'TUPNAGro+T13huJEV5rMGkSpUarubI79v5PCH9Is+QA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031