UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y+Uvc/HFeFnNtuVt/vdvBwcUCUYkx5jH6vEM9v74VqU='
WHERE
key_id = 'd2a9a0367dae5cbceefd311c8529412b3d1df987fab85196b360cb8311e4a9ab'
AND (
token = 'Y+Uvc/HFeFnNtuVt/vdvBwcUCUYkx5jH6vEM9v74VqU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)