UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4oyA5smdwNXcaOVmH1pTRAEFVermhYnr8x2c23JRm7o='
WHERE
key_id = 'a250ab067a2e6959e82f31c628b8979aee6eae52915e57bb4908f64f25b07ad4'
AND (
token = '4oyA5smdwNXcaOVmH1pTRAEFVermhYnr8x2c23JRm7o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)