UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Canx2jvKDdlhxjw+1DUbpjwaqdbpX24ArIybtqd9Qk='
WHERE
key_id = 'd6dd22f5cd1a1a2bd1572417157e93a885911fbcfa095a496cbaac380c1788a7'
AND (
token = '3Canx2jvKDdlhxjw+1DUbpjwaqdbpX24ArIybtqd9Qk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)