UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pgAuxJauWrlBc0oPd7v+wc7neKIf0l/3+KiuIV7YdBM='
WHERE
key_id = 'f00cd7b79fac13e8a41b8323454100d8621fa0c06625a1f55ef0f836fe31c94e'
AND (
token = 'pgAuxJauWrlBc0oPd7v+wc7neKIf0l/3+KiuIV7YdBM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)