UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5NcSZAjtRQ9w48YNLJF54MmFkQPUHX+oIYaNEGovaow='
WHERE
key_id = '3e4c7140159a4cd25ba49676654161a34568cfdd098e5873cc5d40716029b97a'
AND (
token = '5NcSZAjtRQ9w48YNLJF54MmFkQPUHX+oIYaNEGovaow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)