UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8zNW8uPG9jnOfHjMucEqvXOkAJSL1SQR7Bs9nMhnyUo='
WHERE
key_id = 'b6fc35c4bbb55610d52bbfb98574dab8666b4270d29209111e2a05cc8453cb8a'
AND (
token = '8zNW8uPG9jnOfHjMucEqvXOkAJSL1SQR7Bs9nMhnyUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)