UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DaenCmnciOQcVke6u2JJEPd/qSHIxihrMnBgweRliRI='
WHERE
key_id = 'ddfd9b7b0d793eabbcc96be5f54f4fcac55e1e617b2ec546ee08de2e43a5a97b'
AND (
token = 'DaenCmnciOQcVke6u2JJEPd/qSHIxihrMnBgweRliRI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)