UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ufOEtddQcsEGJBujKOPf/J3chBdMrQbSO9W4vshBUbk='
WHERE
key_id = '8009f5fa038f40f92bab5d2b953be80a0395688d84a405fe20349894793d1139'
AND (
token = 'ufOEtddQcsEGJBujKOPf/J3chBdMrQbSO9W4vshBUbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)