UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pxXWPrNIFhkTg5AZu9AEu1ktnFaXm/xOd/6I11c/TLk='
WHERE
key_id = 'a1dc009d2aed501368621f1fc4e167995d20295e62419ddaa924b58ed40015f1'
AND (
token = 'pxXWPrNIFhkTg5AZu9AEu1ktnFaXm/xOd/6I11c/TLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)