UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YsRGivpo48iPAQ3EI4Gi8CIMj1wjjo4dIxHf8riB+RA='
WHERE
key_id = '78545870aed0fae49b62e6c7a7e05b1b8cbb1122ae932b7b1336a1a5f79cecd8'
AND (
token = 'YsRGivpo48iPAQ3EI4Gi8CIMj1wjjo4dIxHf8riB+RA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)