UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/02gsfq9IB2gP5VgGEsxHTiqZh2w4v1llecQtJ2FspQ='
WHERE
key_id = 'f8ba9bd5fb78fabf183c99e6559d5e83f5a1f82e3c9dd9a253167ceea0894aef'
AND (
token = '/02gsfq9IB2gP5VgGEsxHTiqZh2w4v1llecQtJ2FspQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)