UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q7V7DNMC03sv2cS0us7zLx2QITgMNX2LRWd/W9tfFrw=' 
WHERE 
  key_id = '4921e5081c6c43fbb53861c826074049da0f192eced2194179a7cfb708692481' 
  AND (
    token = 'q7V7DNMC03sv2cS0us7zLx2QITgMNX2LRWd/W9tfFrw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028