UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uWvf9Oc7b3VNL1UdxHLA6Ph2WfMK+Z1kagnuEQobB+E='
WHERE
key_id = 'b150c3b942767e3013ddc52de770fe6d94a45c5ad93ded9a3b20ea9661a234ae'
AND (
token = 'uWvf9Oc7b3VNL1UdxHLA6Ph2WfMK+Z1kagnuEQobB+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)