UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kJQRNCdQkLxDqXBgFSHwEoBgjRW9P64ceFi97Qc7s0U=' 
WHERE 
  key_id = '2771ef0ed0d8f225d2caac55ca7e8a81dc9b71e5b375b8056f11503ef2e65627' 
  AND (
    token = 'kJQRNCdQkLxDqXBgFSHwEoBgjRW9P64ceFi97Qc7s0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043