UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z54kf7403xtkAONbCLaO3uP2FCuLZe/X/5+92FDhqfk='
WHERE
key_id = '31ec81b807bb876f8ba0d94e99fc250c47a06ac15ad99366e91c06da5c76ea15'
AND (
token = 'z54kf7403xtkAONbCLaO3uP2FCuLZe/X/5+92FDhqfk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)