UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aCp27NWBDiIEUd8oFMJ4lzj2mudjJoyRAbfmnT2QC5g='
WHERE
key_id = 'c07d2c0ff44548229262d9c51ddbd8302824b3dd39c9c05846d58a2ed1aee41b'
AND (
token = 'aCp27NWBDiIEUd8oFMJ4lzj2mudjJoyRAbfmnT2QC5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)