UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h9OKWNgBLZqa4uomr+XvpcfPzy6xDYKqucl01C9pJk8='
WHERE
key_id = '900c64ed7e5bfad69712c6ea690ec5aac68d3893372a6b014c485c969eb7b1be'
AND (
token = 'h9OKWNgBLZqa4uomr+XvpcfPzy6xDYKqucl01C9pJk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)