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