UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mItDzx63X5lTKbDFtclIKidijFx21Flvxp+RKgT5qgk='
WHERE
key_id = 'ff4d98fa705df15d9515371c884672b01f99cde633abe9efe02f48a7655aa057'
AND (
token = 'mItDzx63X5lTKbDFtclIKidijFx21Flvxp+RKgT5qgk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)