UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EMV3ljzo9B3CGcr2qgb1MOGcn89RXcCvpzBttIaCnqs='
WHERE
key_id = '400e5e6094f846991342b1898578611bdeae9e37ea4c1c90b4efab1cf726b961'
AND (
token = 'EMV3ljzo9B3CGcr2qgb1MOGcn89RXcCvpzBttIaCnqs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)