UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uOo8WMwuMwhrjrNSvWae3P5e0tFJWgeLkq2cbl9MPq0='
WHERE
key_id = '9a34ff1f5aa51efb1802651da1312c539311ba08439763da8236f1477595254c'
AND (
token = 'uOo8WMwuMwhrjrNSvWae3P5e0tFJWgeLkq2cbl9MPq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)