UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZEesranJuiCtGVGCVK47/ymq5wvAY8gZ7cdD19HbjOE='
WHERE
key_id = 'c126675f1299a96c4b19a17fb06f52f6d488c2526599a979bce4c6ca3acd2119'
AND (
token = 'ZEesranJuiCtGVGCVK47/ymq5wvAY8gZ7cdD19HbjOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)