UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gNpnc2UFGragHJL2TO79e8+6PfgLyoZZAeVMijkr7to='
WHERE
key_id = '7cd0f13c96e2279c508aaab7efe400e50a2fcc6d796e947fafab4a7700d3ca17'
AND (
token = 'gNpnc2UFGragHJL2TO79e8+6PfgLyoZZAeVMijkr7to='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)