UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IyD45oRC0JhVsfcCYUHAhWuROf8MmVFaT+FyFCWBeqY='
WHERE
key_id = '31124ce69f24c8e75582c4ea7ce637ae5d3f56372967f701858986bfecaa27da'
AND (
token = 'IyD45oRC0JhVsfcCYUHAhWuROf8MmVFaT+FyFCWBeqY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)