UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QNgcO5NcN/iG/N7/e4fhuNdscyCcL1HNrYMW2ZFR48g='
WHERE
key_id = '51d4e680fc3693d366a6ba8c1b0dcef4d72b068b3c6165b4b6d8683b7ed0b55a'
AND (
token = 'QNgcO5NcN/iG/N7/e4fhuNdscyCcL1HNrYMW2ZFR48g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)