UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ok8B+fOoa8fSrWZIQPn6/eWbHNeqacUE4x11GZ6rxp8='
WHERE
key_id = 'bcd239285714ebfcaa314885c7e59be579bff6b6e5616ac727a96dbcf0256fc9'
AND (
token = 'Ok8B+fOoa8fSrWZIQPn6/eWbHNeqacUE4x11GZ6rxp8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)