UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FrjGJEmMNLZcngWOYxB8bIpK5BhVGJ15mVdgJLqs6SM=' 
WHERE 
  key_id = '799159a2734c2f96a8a856fbca9c2ec5be89bb3537cc9ec49fa9bbd4744ef997' 
  AND (
    token = 'FrjGJEmMNLZcngWOYxB8bIpK5BhVGJ15mVdgJLqs6SM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022