UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4dMOsMxWlkDCYP7aPsl1UeSCfMcXL5GHOB0ALg83RT4='
WHERE
key_id = 'a1dda8b117ab81e9f55988db2db9d3b9a70144106b981a174e862794d073bacb'
AND (
token = '4dMOsMxWlkDCYP7aPsl1UeSCfMcXL5GHOB0ALg83RT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)