UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'knWD7DUBcKNZcitUidizUOVTNw7BStW2jtbzVedhTLc=' 
WHERE 
  key_id = 'f035f0d95513fd7ba1453cb7c7cfc681c6cfd4a2dca559d0eebfed81b361ba22' 
  AND (
    token = 'knWD7DUBcKNZcitUidizUOVTNw7BStW2jtbzVedhTLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023