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