UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MD+1f+QDkmgjNxBONUYSssyivRFyjn+2Y4gA0+1Yimk='
WHERE
key_id = 'c314cfb1e20b7436f2f4a40e75c8be9a11e73d121554b5bd61057cc04c7fe3fc'
AND (
token = 'MD+1f+QDkmgjNxBONUYSssyivRFyjn+2Y4gA0+1Yimk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)