UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3sbi6v1CMJA0VBlmpxWRjjUNAkh9Hg76ogmq+k+cjN4=' 
WHERE 
  key_id = '9945f55f03cfeddf65267907f2af87c6af9268613e103ae0319d9c86cce2139f' 
  AND (
    token = '3sbi6v1CMJA0VBlmpxWRjjUNAkh9Hg76ogmq+k+cjN4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025